<?php
$log = "d://stuff/servant/log.txt";
$cc = fopen ($log,"a");

$xml = $_POST['xmlData'];
$userid = $_POST['userid'];

$da = date("d.m.y") . ' ' . date("H:i:s") . ": POST->xmlData = " . $xml ."\n";
fwrite($cc, $da);
$da = date("d.m.y") . ' ' . date("H:i:s") . ": POST-> userid = " . $userid . "\n";
fwrite($cc, $da);

$dir = "d:/stuff/servant/xml/".$userid . "/" ;

mkdir($dir); 

$da = date("d.m.y") . ' ' . date("H:i:s") . ": create dir " . $dir . " \n";
fwrite($cc, $da);

$file_path = $dir . "rate.xml";

$da = date("d.m.y") . ' ' . date("H:i:s") . ": way to save the file " . $file_path . " \n";
fwrite($cc, $da);

$c = fopen ($file_path,"w+");
fwrite($c, $xml);
fclose($c);
fclose($cc);

?>